from api_post_class import *
import json
from sys import exit
from config import *
import time
import requests
from config import *
def AddOutlineNumber():
    authType = 1
    operation = "Enterprises"
    function = "addOutlineNumber"
    outLineNumbers = "huanglin,15861800293;hlwqds,15861800233"
    params = {
        "outLineNumbers": outLineNumbers,
    }
    f = ApiPost(auth_info, domain, version, "json")

    f.set_func_mode(operation, function, authType)
    rsp = f.post_info_to_api(params)
    print(rsp)
    rsp_dic = json.loads(rsp)
    try:
        if rsp_dic['resp']['respCode'] != 0:
            print("Error, please check and retry")
    except Exception as e:
        print(e)


def DelOutlineNumber():
    authType = 1
    operation = "Enterprises"
    function = "delOutlineNumber"
    outLineNumbers = "15861800293,15861800233"
    params = {
        "outLineNumbers": outLineNumbers,
    }
    f = ApiPost(auth_info, domain, version, "json")

    f.set_func_mode(operation, function, authType)
    rsp = f.post_info_to_api(params)
    print(rsp)
    rsp_dic = json.loads(rsp)
    try:
        if rsp_dic['resp']['respCode'] != 0:
            print("Error, please check and retry")
    except Exception as e:
        print(e)


def GetOutlineNumberS():
    authType = 1
    operation = "Enterprises"
    function = "getOutlineNumber"
    params = {
    }
    f = ApiPost(auth_info, domain, version, "json")

    f.set_func_mode(operation, function, authType)
    rsp = f.post_info_to_api(params)
    print(rsp)
    try:
        if rsp['resp']['respCode'] != 0:
            print("Error, please check and retry")
    except Exception as e:
        print(e)


if __name__ == "__main__":
    #AddOutlineNumber()
    #GetOutlineNumberS()
    DelOutlineNumber()